package com.xiaoqiang.commons.base.exception;

import com.xiaoqiang.commons.base.status.Status;
import lombok.Data;

@Data
public class BaseException extends RuntimeException {
    private int code;
    private String message;

    public BaseException() {
        code = -1;
        message = "Something happened!";
    }

    public BaseException(Status status) {
        this(status.getCode(), status.getDescription());
    }

    public BaseException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public BaseException(Throwable cause, int code, String message) {
        super(cause);
        this.code = code;
        this.message = message;
    }
}
